import * as NS from "./NetServiceBase";
import { Config } from "../Config";
import { EventArgs, TYObject } from "../TYLibrary/System/System";
import { IsNull } from "../TYLibrary/Common/GlobalExtend";
import { ModuleManager } from "./ModuleManager/ModuleManager";
import { Wx_Application, Wx_Page, WXAuthType } from "./EntityBase";
import { WXScopeType } from "../wxAPI_";

export class Wx_XSP_Application extends Wx_Application {
    public ShopInfo: V_Store = null;
    public StoreIndex = new V_Store();
    public Goods: V_Goods = new V_Goods();
    public GoodsList: Array<V_Goods> = new Array<V_Goods>();
    public CategoryList: Array<V_Category> = new Array<V_Category>();
    //购物车列表
    public CartList: Array<V_Cart> = new Array<V_Cart>();
    //云币
    public CurrencyTList: Array<V_Currency> = new Array<V_Currency>();
    public CurrencyFList: Array<V_Currency> = new Array<V_Currency>();
    //用户优惠券
    public Member_CouponTList: Array<V_Member_Coupon> = new Array<V_Member_Coupon>();
    public Member_CouponFList: Array<V_Member_Coupon> = new Array<V_Member_Coupon>();
    //用户地址
    public ReceivingAddress: Array<V_ReceivingAddress> = new Array<V_ReceivingAddress>();
    public m_globalData = {
        tabBar: {
            color: "#999999",
            backgroundColor: "#ffe",
            selectedColor: "#ff4444",
            borderStyle: "#e8e8e8",
            list: [
                {
                    pagePath: "/pages/Index/Index",
                    text: "店主精选",
                    iconPath: "/img/ico_1.png",
                    selectedIconPath: "/img/s_ico_1.png",
                    clas: "menu-item",
                    active: true
                },
                {
                    pagePath: "/pages/ProductClass/Index",
                    text: "更多特卖",
                    iconPath: "/img/ico_2.png",
                    selectedIconPath: "/img/s_ico_2.png",
                    clas: "menu-item",
                    active: false
                },
                {
                    pagePath: "/pages/ShoppingCart/Index",
                    text: "购物车",
                    iconPath: "/img/ico_3.png",
                    selectedIconPath: "/img/s_ico_3.png",
                    clas: "menu-item",
                    active: false
                },
                {
                    pagePath: "/pages/UserInfo/Index",
                    text: "我的",
                    iconPath: "/img/ico_4.png",
                    selectedIconPath: "/img/s_ico_4.png",
                    clas: "menu-item",
                    active: false
                }
            ],
            position: "bottom"
        },
        tabBar2: {
            color: "#999999",
            backgroundColor: "#ffe",
            selectedColor: "#ff4444",
            borderStyle: "#e8e8e8",
            list: [
                {
                    pagePath: "/pages/DZ/Index/Index",
                    text: "选品",
                    iconPath: "/img/DZ/ico_1.png",
                    selectedIconPath: "/img/DZ/s_ico_1.png",
                    clas: "menu-item",
                    active: true
                },
                {
                    pagePath: "/pages/DZ/ProductShelf/Index",
                    text: "货架",
                    iconPath: "/img/DZ/ico_2.png",
                    selectedIconPath: "/img/DZ/s_ico_2.png",
                    clas: "menu-item",
                    active: false
                },
                {
                    pagePath: "/pages/DZ/Shop/Index",
                    text: "店铺",
                    iconPath: "/img/DZ/ico_3.png",
                    selectedIconPath: "/img/DZ/s_ico_3.png",
                    clas: "menu-item",
                    active: false
                },
                {
                    pagePath: "/pages/DZ/UserInfo/Index",
                    text: "我的",
                    iconPath: "/img/DZ/ico_4.png",
                    selectedIconPath: "/img/DZ/s_ico_4.png",
                    clas: "menu-item",
                    active: false
                }
            ],
            position: "bottom"
        }
    };

    public async onLaunch(options: WXAppAPI_OptionsObj) {
        this.IndexPageType = PageType.AppIndex;
        console.log(this.IndexPageType);
        super.onLaunch(options);
        this.ModuleManager = new ModuleManager(this);
        wx.showShareMenu({ withShareTicket: true });
    }

    public WX_ReLanch(page: PageType): void {
        wx.reLaunch({ url: page });
    }
    public WX_SwitchTab(page: PageType): void {
        wx.switchTab({ url: page });
    }
    public WX_NavigateTo(page: PageType, params?: any): void {
        let ParamsStr = "";
        if (params && !IsNull(params) && typeof params == "object") {
            let keys = Object.keys(params);
            for (let i = 0; i < keys.length; i++) {
                ParamsStr += keys[i] + "=" + params[keys[i]];
                if (i < keys.length - 1) ParamsStr += "&";
            }
        }
        if (!ParamsStr.IsNullOrWhiteSpace()) ParamsStr = "?" + ParamsStr;
        console.log("navigateTo...", page + ParamsStr);
        wx.navigateTo({ url: page + ParamsStr });
    }
}

/**
 * 小程序生命周期
 *
 * @export
 * @class Wx_XSPPage
 * @extends {Wx_Page}
 */
export class Wx_XSPPage extends Wx_Page {
    public App: Wx_XSP_Application = null;

    public SaveLastPage: boolean = true;
    public LoadOptions: any;

    //第一种状态的底部
    public EditTabBar() {
        var _curPageArr = getCurrentPages();
        var _curPage = _curPageArr[_curPageArr.length - 1];
        var _pagePath = _curPage.__route__;
        if (_pagePath.indexOf("/") != 0) {
            _pagePath = "/" + _pagePath;
        }
        var tabBar = this.App.m_globalData.tabBar;
        for (var i = 0; i < tabBar.list.length; i++) {
            tabBar.list[i].active = false;
            if (tabBar.list[i].pagePath == _pagePath) {
                tabBar.list[i].active = true; //根据页面地址设置当前页面状态
            }
        }
        _curPage.setData({ tabBar: tabBar });
    }
    //第二种状态的底部
    public EditTabBar2() {
        var _curPageArr = getCurrentPages();
        var _curPage = _curPageArr[_curPageArr.length - 1];
        var _pagePath = _curPage.__route__;
        if (_pagePath.indexOf("/") != 0) {
            _pagePath = "/" + _pagePath;
        }
        var tabBar = this.App.m_globalData.tabBar2;
        var booleans: boolean;
        for (var i = 0; i < tabBar.list.length; i++) {
            if (tabBar.list[i].active == true && tabBar.list[i].pagePath == _pagePath) {
                console.log(_pagePath, "_pagePath");
                booleans = true;
                _curPage.setData({ tabBar: tabBar });
                return;
            } else {
                tabBar.list[i].active = false;
                if (tabBar.list[i].pagePath == _pagePath) {
                    tabBar.list[i].active = true; //根据页面地址设置当前页面状态
                    booleans = true;
                }
            }
        }
        if (booleans == true) {
            _curPage.setData({ tabBar: tabBar });
        }
    }

    public async bindopenSetting(e) {
        if (e.detail.errMsg) {
            await this.App.ModuleManager.AuthManager.Refresh();
            if (e.detail.authSetting[WXScopeType.userInfo] == true) {
                await this.InitData(this.LoadOptions);
            }
        }
    }

    public async get_bindUserInfo(e) {
        await this.App.ModuleManager.AuthManager.Refresh();
        if (e.detail.userInfo) {
            await this.InitData(this.LoadOptions);
        }
        await super.__SetData({ AuthSetting: this.App.WXLoginInfo.AuthSetting });
    }

    public async InitData(options: any) {
        await super.__SetData({ AuthSetting: this.App.WXLoginInfo.AuthSetting });
        if (this.App.WXLoginInfo.AuthSetting == WXAuthType.AuthSuccess)
            await this.AuthInitData(options);
    }

    public async AuthInitData(options: any) {}
}

export enum PageType {
    /** 精选 */
    AppIndex = "/pages/Index/Index",
    /** 分类*/
    ProductClassIndex = "/pages/ProductClass/Index",
    /** 购物车 */
    ShoppingCartIndex = "/pages/ShoppingCart/Index",
    /** 我的 */
    UserInfoIndex = "/pages/UserInfo/Index"
}

export enum OrderStatus {
    //待付款
    DFK = "待付款",
    //待发货
    DFH = "待发货",
    //已发货
    YFH = "已发货",
    //已完成
    YWC = "已完成"
}
export enum _OrderStatus {
    //待付款
    DFK = 1,
    //待发货
    DFH = 2,
    //已发货
    YFH = 3,
    //已完成
    YWC = 4
}

export enum CartGoodsStatus {
    //可购商品
    KGSP = 1,
    //预热商品
    YRSP = 2,
    //下架商品
    XJSP = 3,
    //售空商品
    SKSP = 4
}

/*---------------数据库------------------*/

export class T_Shop extends TYObject {
    public ID: number;
    public OPENID: string;
    /**
     * 商铺名称
     *
     * @type {string}
     * @memberof T_Shop
     */
    public NAME: string;
    /**
     * 联系电话
     *
     * @type {string}
     * @memberof T_Shop
     */
    public TEL: string;
    /**
     * 店铺图标
     *
     * @type {string}
     * @memberof T_Shop
     */
    public PIC: string;
    /**
     * 企业认证
     *
     * @type {boolean}
     * @memberof T_Shop
     */
    public IS_QYRZ: boolean;
    /**
     * 担保交易
     *
     * @type {boolean}
     * @memberof T_Shop
     */
    public IS_DBJY: boolean;
    /**
     * 线下门店
     *
     * @type {boolean}
     * @memberof T_Shop
     */
    public IS_XXMD: boolean;
}
//商品
export class T_Product extends TYObject {
    public ID: number;
    /**
     * 店铺ID
     *
     * @type {number}
     * @memberof T_Product
     */
    public SHOPID: number;
    /**
     * 商品名称
     *
     * @type {string}
     * @memberof T_Product
     */
    public NAME: string;
    /**
     * 商品描述
     *
     * @type {string}
     * @memberof T_Product
     */
    public TITLE: string;
    /**
     * 商品详情
     *
     * @type {string}
     * @memberof T_Product
     */
    public DESC: string;
    /**
     * 小缩略图
     *
     * @type {string}
     * @memberof T_Product
     */
    public THUMBNAILSMALL: string;
    /**
     * 大缩略图
     *
     * @type {string}
     * @memberof T_Product
     */
    public THUMBNAILSBIG: string;
    /**
     * 商品图片，多张图以|分隔
     *
     * @type {string}
     * @memberof T_Product
     */
    public PICS: string;
    /**
     * 商品单价
     *
     * @type {number}
     * @memberof T_Product
     */
    public PRICE: number;
    /**
     * 运费
     *
     * @type {number}
     * @memberof T_Product
     */
    public FREIGHT: number;
    /**
     * 剩余数量
     *
     * @type {number}
     * @memberof T_Product
     */
    public COUNT: number;
    /**
     * 更新时间
     *
     * @type {number}
     * @memberof T_Product
     */
    public UPDATETIME: number;
    /**
     * 是否是热门产品
     *
     * @type {boolean}
     * @memberof T_Product
     */
    public IS_HOT: boolean;
    /**
     * 是否是最新产品
     *
     * @type {boolean}
     * @memberof T_Product
     */
    public IS_NEW: boolean;
}
//购物车*/
export class T_ShoppingCart extends TYObject {
    public ID: number;
    public OPENID: string;
    /**
     * 店铺ID
     *
     * @type {string}
     * @memberof T_ShoppingCart
     */
    public SHOPID: number;
    /**
     * 店铺名称，SQL中不存储，关联查找更新
     *
     * @type {string}
     * @memberof T_ShoppingCart
     */
    public SHOPNAME: string;
    /**
     * 商品ID
     *
     * @type {string}
     * @memberof T_ShoppingCart
     */
    public PRODUCTID: number;
    /**
     * 商品名称
     *
     * @type {string}
     * @memberof T_ShoppingCart
     */
    public PRODUCTNAME: string;
    /**
     * 商品图片，加入购物车时从商品中获取
     *
     * @type {string}
     * @memberof T_ShoppingCart
     */
    public PRODUCTTHUMBNAIL: string;
    /**
     * 商品单价
     *
     * @type {number}
     * @memberof T_ShoppingCart
     */
    public OLD_PRODUCTPRICE: number;
    /**
     * 商品数量
     *
     * @type {number}
     * @memberof T_ShoppingCart
     */
    public PRODUCTCOUNT: number;
    /**
     * 更新时间
     *
     * @type {number}
     * @memberof T_ShoppingCart
     */
    public UPDATETIME: number;
}
//商店
export class T_Store extends TYObject {
    public ID: number;
    /**
     * '所属用户ID
     * @type @type {number}
     * @extends {T_Store}
     */
    public MEMBERID: number;
    /**
     * 平台ID
     * @type @type {number}
     * @extends {T_Store}
     */
    public PLATFORMID: number;
    /**
     * 店铺序号
     * @type @type {string}
     * @extends {T_Store}
     */
    public STORNO: string;
    /**
     * 店铺名称
     * @type @type {string}
     * @extends {T_Store}
     */
    public NAME: string;
    /**
     * 店铺描述
     * @type @type {string}
     * @extends {T_Store}
     */
    public DESC: string;
    /**
     * 店铺头像
     * @type @type {string}
     * @extends {T_Store}
     */
    public AVATARURL: string;
    /**
     * 店铺banner
     * @type @type {string}
     * @extends {T_Store}
     */
    public BANNER: string;
    /**
     * 店铺余额
     * @type @type {string}
     * @extends {T_Store}
     */
    public BALANCE: string;

    /**
     * 店铺等级
     * @type @type {number}
     * @extends {T_Store}
     */
    public STORTGRADE: number;

    /**
     * 创建时间
     * @type @type {number}
     * @extends {T_Store}
     */
    public CREATETIME: number;
    /**
     *
     * 商品信息
     * @type {T_Goods}
     * @extends {T_Store}
     */
    public GOODS: Array<T_Goods>;
}
//商店商品
export class T_Store_Goods extends TYObject {
    public ID: number;
    /**
     * 商品编号
     * @type @type {string}
     * @extends {T_Store_Goods}
     */
    public GOODSNO: string;
    /**
     *店铺ID
     * @type @type {number}
     * @extends {T_Store_Goods}
     */
    public STOREID: number;

    /**
     * 创建时间
     * @type @type {number}
     * @extends {T_Store_Goods}
     */
    public CREATETIME: number;
}
//商品跟随的店铺关系
export class T_Store_Follow_Goods extends TYObject {
    public ID: number;

    /**
     *店铺ID
     * @type @type {number}
     * @extends {T_Store_Goods}
     */
    public STOREID: number;
    /**
     * 商品编号
     * @type @type {string}
     * @extends {T_Store_Goods}
     */
    public GOODSNO: string;

    /**
     * 创建时间
     * @type @type {number}
     * @extends {T_Store_Goods}
     */
    public CREATETIME: number;
}
export class T_Store_Statistics extends TYObject {
    public ID: number;

    public MEMBERID: number;
}
//商品
export class T_Goods extends TYObject {
    public ID: number;
    /**
     * 平台ID
     * @type @type {number}
     * @extends {T_Goods}
     */
    public PLATFORMID: number;

    /**
     * 商品牌品ID
     * @type @type {number}
     * @extends {T_Goods}
     */
    public BRANDID: number;
    /**
     * 商品类目ID
     * @type @type {number}
     * @extends {T_Goods}
     */
    public CATEGORYID: number;
    /**
     * 商品编号
     * @type @type {string}
     * @extends {T_Goods}
     */
    public GOODSNO: string;
    /**
     * 商品名称
     * @type @type {string}
     * @extends {T_Goods}
     */
    public NAME: string;
    /**
     * 商品副标题
     * @type @type {string}
     * @extends {T_Shop}
     */
    public TITLE: string;
    /**
     * 商品状态1销售中2下架
     * @type @type {number}
     * @extends {T_Goods}
     */
    public GOODSSTATUS: number;
    /**
     * 商品运费
     * @type @type {number}
     * @extends {T_Goods}
     */
    public EXPRESSAMOUNT: number;
    /**
     * 商品发货时间说明
     * @type @type {string}
     * @extends {T_Goods}
     */
    public EXPRESSREMAK: string;
    /**
     * 商品是否特卖
     * @type @type {boolean}
     * @extends {T_Goods}
     */
    public ISSALE: boolean;
    /**
     * 特卖开始时间
     * @type @type {number}
     * @extends {T_Goods}
     */
    public SALESTARTTIME: string;
    /**
     * 特卖结束时间
     * @type @type {number}
     * @extends {T_Goods}
     */
    public SALEENDTIME: string;

    /**
     * 创建时间
     * @type @type {number}
     * @extends {T_Shop}
     */
    public CREATETIME: number;
    /**
     * 修改时间
     * @type @type {number}
     * @extends {T_Shop}
     */
    public UPLOADTIME: number;
    /**
     * Cover
     *  @type {string}
     * @extends {T_Goods}
     */
    public COVER: string;
    /**
     * Goods_SKu
     * @type @type {T_Goods_SKu}
     * @extends {T_Shop}
     */
    public GOODSSKU: T_Goods_SKu;
    /**
     * Goods_SKu
     * @type @type {T_Goods_SKu}
     * @extends {T_Shop}
     */
    public SKUS: T_Goods_SKu;
    /**
     * T_Goods_Img
     * @type @type {T_Goods_Img}
     * @extends {T_Shop}
     */
    public GOODSIMG: T_Goods_Img;
}
//商品规格
export class T_Goods_SKu extends TYObject {
    public ID: number;

    /**
     * 商品ID
     * @type @type {number}
     * @extends {T_Goods_SKu}
     */
    public GOODSID: number;
    /**
     * SKU名称
     * @type @type {string}
     * @extends {T_Goods_SKu}
     */
    public SKUNAME: string;
    /**
     * 原价
     * @type @type {number}
     * @extends {T_Goods_SKu}
     */
    public ORIGINALPRICE: number;
    /**
     * 销售价格
     * @type @type {number}
     * @extends {T_Goods_SKu}
     */
    public PRICE: number;
    /**
     * 库存
     * @type @type {number}
     * @extends {T_Goods_SKu}
     */
    public STOCK: number;
    /**
     * 特卖价格
     * @type @type {number}
     * @extends {T_Goods_SKu}
     */
    public FAVORABLEPRICE: number;
    /**
     * 排序
     * @type @type {number}
     * @extends {T_Goods_SKu}
     */
    public SORT: number;
    /**
     * 特卖限量
     * @type @type {number}
     * @extends {T_Goods_SKu}
     */
    public LIMITATION: number;
    /**
     * 分销利润
     * @type @type {number}
     * @extends {T_Goods_SKu}
     */
    public DISTRIBUTIONPROFIT: number;
}
//商品图片
export class T_Goods_Img extends TYObject {
    public ID: number;

    /**
     * 商品ID
     * @type @type {number}
     * @extends {T_Goods_Img}
     */
    public GOODSID: number;
    /**
     * 图片地址
     * @type @type {string}
     * @extends {T_Goods_Img}
     */
    public PICURL: string;
    /**
     *排序
     * @type @type {number}
     * @extends {T_Goods_Img}
     */
    public SORT: number;
    /**
     *排序
     * @type @type {boolean}
     * @extends {T_Goods_Img}
     */
    public ISCOVER: boolean;
}
//商品详情
export class T_Goods_Details extends TYObject {
    public ID: number;

    /**
     * 商品ID
     * @type @type {number}
     * @extends {T_Goods_Img}
     */
    public GOODSID: number;
    /**
     * 类型 1商品介绍 2规格参数 3 购买须知
     * @type @type {number}
     * @extends {T_Goods_Img}
     */
    public TYPE: number;
    /**
     * 图片地址
     * @type @type {string}
     * @extends {T_Goods_Img}
     */
    public IMGURL: string;
    /**
     *排序
     * @type @type {number}
     * @extends {T_Goods_Img}
     */
    public SORT: number;
}
//购物车
export class T_Cart extends TYObject {
    public ID: number;

    /**
     * PLATFORMID平台ID
     * @type @type {number}
     * @extends {T_Cart}
     */
    public PLATFORMID: number;

    /**
     * 店铺ID
     * @type {number}
     * @memberof T_Cart
     */
    public STOREID: number;

    /**
     *  会员ID
     * @type {number}
     * @memberof T_Cart
     */
    public MEMBERID: number;

    /**
     * 商品编号
     * @type {string}
     * @memberof T_Cart
     */
    public GOODSNO: string;

    /**
     * 商品数量
     * @type {number}
     * @memberof T_Cart
     */
    public GOODSNUM: number;

    /**
     * 选择的SKU
     * @type {string}
     * @memberof T_Cart
     */
    public GOODSSKU: string;

    /**
     * 是否选中
     * @type {boolean}
     * @memberof T_Cart
     */
    public ISSELECT: boolean;

    /**
     * 添加时间
     * @type {string}
     * @memberof T_Cart
     */
    public ADDTIME: string;
}

//分类
export class T_Category extends TYObject {
    /**
     * 分类ID
     * @type @type {number}
     * @extends {T_Category}
     */
    public ID: number;
    /**
     * 商品类目ID
     * @type @type {number}
     * @extends {T_Category}
     */
    public PLATFORMID: number;
    /**
     * 上级ID
     * @type @type {string}
     * @extends {T_Goods}
     */
    public ParentId: string;
    /**
     * 分类名称
     * @type @type {string}
     * @extends {T_Category}
     */
    public NAME: string;
    /**
     * 排序
     * @type @type {number}
     * @extends {T_Category}
     */
    public SORT: number;

    /**
     * 分类banner
     * @type @type {string}
     * @extends {T_Category}
     */
    public BANNER: string;

    /**
     * 分类Logo
     * @type @type {string}
     * @extends {T_Category}
     */
    public LOGO: string;
    /**
     * 分类描述
     * @type @type {string}
     * @extends {T_Category}
     */
    public DESC: string;
    /**
     * 分类状态
     * @type @type {string}
     * @extends {T_Category}
     */
    public STATE: string;

    /**
     * 创建时间
     * @type @type {number}
     * @extends {T_Category}
     */
    public CREATETIME: number;
}

//云币
export class T_Currency extends TYObject {
    public ID: number;
    /**
     * PLATFORMID平台ID
     * @type @type {number}
     * @extends {T_Currency}
     */
    public PLATFORMID: number;
    /**
     * MemberId会员ID
     * @type @type {number}
     * @extends {T_Currency}
     */
    public MEMBERID: number;
    /**
     * 数量
     * @type @type {number}
     * @extends {T_Currency}
     */
    public COUNT: number;
    /**
     * 云币描述
     * @type @type {string}
     * @extends {T_Currency}
     */
    public DESC: string;
    /**
     * 有效期（天）
     * @type @type {number}
     * @extends {T_Currency}
     */
    public TERMOFVALIDITY: number;
    /**
     * 是否使用
     * @type @type {boolean}
     * @extends {T_Currency}
     */
    public ISAPPLAY: boolean;

    /**
     * 开始时间
     * @type @type {number}
     * @extends {T_Currency}
     */
    public STARTTIME: number;
    /**
     * 结束时间
     * @type @type {number}
     * @extends {T_Currency}
     */
    public ENDTIME: number;

    /**
     * 使用时间
     * APPLAYTIME
     * @type @type {number}
     * @extends {T_Currency}
     */
    public APPLAYTIME: number;
}
//优惠券
export class T_Coupon extends TYObject {
    public ID: number;
    /**
     * 店铺ID
     *
     * @type {number}
     * @memberof T_Coupon
     */
    public SHOPID: number;
    /**
     * 用户ID
     *
     * @type {number}
     * @memberof T_Coupon
     */
    public MEMBERID: number;
    /**
     * 优惠卷编号
     *
     * @type {number}
     * @memberof T_Coupon
     */
    public COUPONNO: number;
    /**
     * 是否使用
     * @type @type {boolean}
     * @extends {T_Coupon}
     */
    public IS_APPLAY: boolean;
    /**
     * 开始时间
     * @type @type {number}
     * @extends {T_Coupon}
     */
    public STARTDATE: number;
    /**
     * 结束时间
     * @type @type {number}
     * @extends {T_Coupon}
     */
    public ENDDATE: number;

    /**
     * 使用时间
     * APPLAYTIME
     * @type @type {number}
     * @extends {T_Coupon}
     */
    public APPLAYTIME: number;
    /**
     *来源(1=平台发放领取，2=店铺分享领取，3=好友赠送)
     * @type @type {number}
     * @extends {T_Coupon}
     */
    public COUPONORIGIN: number;
    /**
     * '赠送用户ID'
     * @type @type {number}
     * @extends {T_Coupon}
     */
    public GIVEMEMBERID: number;
}
//优惠券可使用商品
export class T_Coupon_Goods extends TYObject {
    public ID: number;
    /**
     * 优惠卷ID
     *
     * @type {number}
     * @memberof T_Coupon
     */
    public COUPONID: number;
    /**
     * 商品编号
     * @type @type {string}
     * @extends {T_Goods}
     */
    public GOODSNO: string;
}
//T_Coupon_Group优惠券组
export class T_Coupon_Group extends TYObject {
    public ID: number;
    /**
     * 平台ID
     * @type @type {number}
     * @extends {T_Coupon_Group}
     */
    public PLATFORMID: number;
    /**
     *来源(1=随机优惠卷，2=裂变优惠券)
     * @type @type {number}
     * @extends {T_Coupon_Group}
     */
    public GROUPTYPE: number;
    /**
     *裂变优惠券领取数
     * @type @type {number}
     * @extends {T_Coupon_Group}
     */
    public GETCOUNT: number;
    /**
     *优惠券组名称
     * @type @type {string}
     * @extends {T_Coupon_Group}
     */
    public GROUPNAME: string;

    /**
     * 是否使用
     * @type @type {boolean}
     * @extends {T_Coupon_Group}
     */
    public STATE: boolean;
    /**
     * 开始时间
     * @type @type {number}
     * @extends {T_Coupon_Group}
     */
    public STARTTIME: number;
    /**
     * 结束时间
     * @type @type {number}
     * @extends {T_Coupon_Group}
     */
    public ENDTIME: number;

    /**
     * 创建时间
     * @type @type {number}
     * @extends {T_Coupon_Group}
     */
    public CREATETIME: number;
}
//优惠券分组记录
export class T_Coupon_Group_Record extends TYObject {
    public ID: number;
    /**
     *优惠券组ID
     * @type @type {string}
     * @extends {T_Coupon_Group_Record}
     */
    public COUPONGROUPID: number;
    /**
     *优惠券ID
     * @type @type {string}
     * @extends {T_Coupon_Group_Record}
     */
    public COUPONID: number;
    /**
     *优是否已经被领取(用于随机优惠券）
     * @type @type {boolean}
     * @extends {T_Coupon_Group_Record}
     */
    public IS_RECEIVE: boolean;
}
//用户信息
export class T_Member extends TYObject {
    public ID: number;
    /**
     * 平台ID
     * @type @type {number}
     * @extends {T_Member}
     */
    public PLATFORMID: number;
    /**
     * 绑定店铺ID
     * @type @type {number}
     * @extends {T_Member}
     */
    public BIND_STOREID: number;
    /**
     * 微信ID
     * @type @type {number}
     * @extends {T_Member}
     */
    public UNIONID: number;

    /**
     * 用户名
     * @type @type {string}
     * @extends {T_Member}
     */
    public MEMBERNAME: string;

    /**
     * 头像
     * @type @type {string}
     * @extends {T_Member}
     */
    public AVATARURL: string;

    /**
     * 生日
     * @type @type {number}
     * @extends {T_Member}
     */
    public BIRTHDAY: number;

    /**
     * 性别
     * @type @type {number}
     * @extends {T_Member}
     */
    public SEX: number;

    /**
     * 手机号码
     * @type @type {number}
     * @extends {T_Member}
     */
    public PHONENUMBER: number;

    /**
     * 最后登录时间
     * @type @type {number}
     * @extends {T_Member}
     */
    public LASTLOGINTIME: number;

    /**
     * 创建时间
     * @type @type {number}
     * @extends {T_Member}
     */
    public CREATETIME: number;
}
//用户登录信息
export class T_Member_Auth extends TYObject {
    /**
     * 用户ID
     * @type @type {number}
     * @extends {T_Member_Auth}
     */
    public MEMBERID: number;
    /**
     * 用户卡号
     *
     * @type @type {string}
     * @extends {T_Member_Auth}
     */
    public CARDNO: string;
    /**
     * 用户名称
     *
     * @type @type {string}
     * @extends {T_Member_Auth}
     */
    public FULLNAME: string;
    /**
     * 登录状态
     * @type @type {boolean}
     * @extends {T_Member_Auth}
     */
    public IS_SUCCESS: boolean;
    /**
     * 登录时间
     * @type @type {number}
     * @extends {T_Member_Auth}
     */
    public AUTHTIME: number;
}
//用户优惠券
export class T_Member_Coupon extends TYObject {
    /**
     * 优惠券用户信息
     *
     * @type {number}
     * @memberof T_Member_Coupon
     */
    public GIVEMEMBER: T_Member;
    /**
     *优惠券可用商品信息
     *
     * @type {number}
     * @memberof T_Member_Coupon
     */

    public AVAILABLEGOODS: T_Goods;
    public ID: number;
    /**
     * 店铺ID
     *
     * @type {number}
     * @memberof T_Member_Coupon
     */
    public SHOPID: number;
    /**
     * 用户ID
     *
     * @type {number}
     * @memberof T_Member_Coupon
     */
    public MEMBERID: number;
    /**
     * 优惠卷编号
     *
     * @type {number}
     * @memberof T_Member_Coupon
     */
    public COUPONNO: number;
    /**
     * 是否使用
     * @type @type {boolean}
     * @extends {T_Member_Coupon}
     */
    public IS_APPLAY: boolean;
    /**
     * 开始时间
     * @type @type {number}
     * @extends {T_Member_Coupon}
     */
    public STARTTIME: number;
    /**
     * 结束时间
     * @type @type {number}
     * @extends {T_Member_Coupon}
     */
    public ENDTIME: number;

    /**
     * 使用时间
     * APPLAYTIME
     * @type @type {number}
     * @extends {T_Member_Coupon}
     */
    public APPLAYTIME: number;
    /**
     *来源(1=平台发放领取，2=店铺分享领取，3=好友赠送)
     * @type @type {number}
     * @extends {T_Coupon}
     */
    public COUPONORIGIN: number;
    /**
     * '赠送用户ID'
     * @type @type {number}
     * @extends {T_Coupon}
     */
    public GIVEMEMBERID: number;
    /**
     * COUPONINFO
     * 优惠券
     */
    public COUPONINFO: T_Coupon;
}
//用户关系
export class T_Member_Relations extends TYObject {
    /**
     * 用户ID
     *
     * @type {number}
     * @memberof T_Coupon
     */
    public MEMBERID: number;
    /**
     * 上级用户ID
     *
     * @type {number}
     * @memberof T_Coupon
     */
    public PARENT_MEMBERID: number;
    /**
     * 用户关系编码
     *
     * @type {number}
     * @memberof T_Coupon
     */
    public RELATIONSNO: number;
    /**
     * 用户唯一编码
     *
     * @type {number}
     * @memberof T_Coupon
     */
    public MEMBERNO: number;
}

//地址
export class T_ReceivingAddress extends TYObject {
    public ID: number;

    /**
     * MemberId会员ID
     * @type @type {number}
     * @extends {T_ReceivingAddress}
     */
    public MEMBERID: number;
    /**
     * 用户名称
     * @type @type {string}
     * @extends {T_ReceivingAddress}
     */
    public USERNAME: string;
    /**
     * 身份证NO
     * @type @type {string}
     * @extends {T_ReceivingAddress}
     */
    public IDCARDNO: string;
    /**
     * LABEL
     * @type @type {string}
     * @extends {T_ReceivingAddress}
     */
    public LABEL: string;
    /**
     * ProvinceName 省
     * @type @type {string}
     * @extends {T_ReceivingAddress}
     */
    public PROVINCENAME: string;
    /**
     * CityName 市
     * @type @type {string}
     * @extends {T_ReceivingAddress}
     */
    public CITYNAME: string;
    /**
     * CountyName区
     * @type @type {string}
     * @extends {T_ReceivingAddress}
     */
    public COUNTYNAME: string;
    /**
     * 详细地址
     * @type @type {string}DetailInfo
     * @extends {T_ReceivingAddress}
     */
    public DETAILINFO: string;
    /**
     * 电话
     * @type @type {number}
     * @extends {T_ReceivingAddress}
     */
    public TELNUMBER: number;

    /**
     * 区号（邮政编号）
     * @type @type {number}
     * @extends {T_ReceivingAddress}
     */
    public PostalCode: string;

    /**
     * 设置默认地址
     * @type @type {boolean}
     * @extends {T_ReceivingAddress}
     */
    public ISDEFAULT: boolean;

    /**
     * PLATFORMID平台ID
     * @type @type {number}
     * @extends {T_ReceivingAddress}
     */
    public PLATFORMID: number;
}
//专题
export class T_Special extends TYObject {
    public ID: number;
    /**
     * 专题标题
     * @type @type {boolean}
     * @extends {T_Special}
     */
    public TITLE: string;
    /**
     * 专题目
     * @type @type {boolean}
     * @extends {T_Special}
     */
    public BANNER: string;
    /**
     * 是否启用
     * @type @type {boolean}
     * @extends {T_Special}
     */
    public STATE: boolean;
    /**
     * 平台ID
     * @type @type {number}
     * @extends {T_Special}
     */
    public PLATFORMID: number;
    /**
     * 创建时间
     * @type @type {number}
     * @extends {T_Special}
     */
    public CREATETIME: number;
}
//专题关联商品
export class T_Special_Goods extends TYObject {
    public ID: number;
    /**
     * 商品编号
     * @type @type {string}
     * @extends {T_Special_Goods}
     */
    public GOODSNO: string;
    /**
     * 专题ID
     * @type @type {number}
     * @extends {T_Special_Goods}
     */
    public SPECIALID: number;
    /**
     * 排序
     * @type @type {number}
     * @extends {T_Special_Goods}
     */
    public SORT: number;
}
//支付信息
export class T_Order_Pay {
    /**
     *支付编号
     * @type @type {number}
     * @extends {T_Order}
     */
    public PAYNO: string;
    /**
     *第三方支付单号
     * @type @type {number}
     * @extends {T_Order}
     */
    public THIRDPARTYPAYNO: string;
    /**
     *支付状态（1=已支付，2=未支付）'
     *
     * @type {number}
     * @memberof T_Order_Pay
     */
    public PAYSTATUS: number;
    /**
     *支付方式
     *
     * @type {string}
     * @memberof T_Order_Pay
     */
    public PAYMENTMODE: string;

    /**
     *支付时间
     *
     * @type {string}
     * @memberof T_Order_Pay
     */
    public PAYMENTTIME: string;

    /**
     *支付金额
     *
     * @type {number}
     * @memberof T_Order_Pay
     */
    public PAYMENTAMOUNT: number;
}
//订单商品
export class T_Order_Goods extends TYObject {
    public ID: number;
    /**
     *订单编号
     * @type @type {number}
     * @extends {T_Order_Goods}
     */
    public ORDERNO: string;
    /**
     * 商品ID
     * @type @type {number}
     * @extends {T_Order_Goods}
     */
    public GOODSID: number;
    /**
     *选择 商品的规格 SKU
     * @type @type {number}
     * @extends {T_Order_Goods}
     */
    public SELECTSKU: number;
    /**
     *选择 商品的名称
     * @type @type {string}
     * @extends {T_Order_Goods}
     */
    public GOODSNAME: string;
    /**
     *选择 商品的图片
     * @type @type {string}
     * @extends {T_Order_Goods}
     */
    public GOODSCOVER: string;
    /**
     *选择 商品的价格
     * @type @type {number}
     * @extends {T_Order_Goods}
     */
    public GOODSPRICE: number;
    /**
     *物流费用
     *
     * @type {number}
     * @memberof T_Order_Goods
     */
    public EXPRESSAMOUNT: number;
    /**
     *选择商品的数量
     *
     * @type {number}
     * @memberof T_Order_Goods
     */
    public QUANTITY: number;
}
//订单
export class T_Order extends TYObject {
    public ID: number;
    /**
     * 平台ID
     * @type @type {number}
     * @extends {T_Order}
     */
    public PLATFORMID: number;
    /**
     * MemberId会员ID
     * @type @type {number}
     * @extends {T_Order}
     */
    public MEMBERID: number;
    /**
     *店铺ID
     * @type @type {number}
     * @extends {T_Order}
     */
    public STOREID: number;
    /**
     *
     *店铺信息
     * @type {T_Store}
     * @memberof T_Order
     */
    public STOREINFO: T_Store;
    /**
     *订单商品信息
     *
     * @type {T_Order_Goods}
     * @memberof T_Order
     */
    public GOODINFO: T_Order_Goods;
    /**
     *订单编号
     * @type @type {number}
     * @extends {T_Order}
     */
    public ORDERNO: string;
    /**
     *支付编号
     * @type @type {number}
     * @extends {T_Order}
     */
    public PAYNO: string;
    /**
     *订单金额
     * @type @type {number}
     * @extends {T_Order}
     */
    public ORDERAMOUNT: number;
    /**
     *物流运费
     *
     * @type {number}
     * @memberof T_Order
     */
    public EXPRESSAMOUNT: number;
    /**
     *订单支付金额
     *
     * @type {number}
     * @memberof T_Order
     */
    public PAYMENTAMOUNT: number;
    /**
     *订单商品规格
     *
     * @type {number}
     * @memberof T_Order
     */
    public ORDERSTATUS: number;
    /**
     *使用太云币ID
     *
     * @type {number}
     * @memberof T_Order
     */
    public APPLAYTYCURRENCYID: number;
    /**
     *使用太云币金额
     *
     * @type {number}
     * @memberof T_Order
     */
    public TYCURRENCYDEDUCTIBLEACCOUNT: number;
    /**
     *
     *使用优惠券ID
     * @type {number}
     * @memberof T_Order
     */
    public APPLAYCOUPONID: number;
    /**
     *使用优惠券金额
     *
     * @type {number}
     * @memberof T_Order
     */
    public COUPONAMOUNT: number;
    /**
     * 创建时间
     * @type @type {number}
     * @extends {T_Order}
     */
    public CREATETIME: number;
    /**
     *订单备注
     *
     * @type {string}
     * @memberof T_Order
     */
    public REMAK: string;
}
// ORDERGOODS	[...]
// STOREINFO	Store{...}
// ORDERPAYINFO	OrderPay{...}
// ID	integer($int32)
// PLATFORMID	integer($int32)
// MEMBERID	integer($int32)
// STOREID	integer($int32)
// APPLAYTYCURRENCYID	integer($int32)
// ORDERNO	string
// PAYNO	string
// ORDERAMOUNT	number($double)
// APPLAYCOUPONID	integer($int32)
// COUPONAMOUNT	number($double)
// PAYMENTAMOUNT	number($double)
// EXPRESSAMOUNT	number($double)
// ORDERSTATUS	integer($int32)
// Enum:
// Array [ 5 ]
// CREATETIME	string($date-time)
// TYCURRENCYDEDUCTIBLEACCOUNT	number($double)
// REMAK	string
/*---------------视图------------------*/
export class V_Store extends T_Store {}

export class V_Goods extends T_Goods {}
export class V_Cart extends T_Cart {
    public Selected: boolean;
    /**
     * 商品
     * @type {T_Goods}
     * @memberof V_Cart
     */
    public GOODS: T_Goods;
    /**
     * 商品SKU
     * @type {T_Goods_SKu}
     * @memberof V_Cart
     */
    public SKU: T_Goods_SKu;
    /**
     * 商品封面图
     * @type {string}
     * @memberof V_Cart
     */
    public COVER: string;
    /**
     * 购物车商品状态
     * @type {CartGoodsStatus}
     * @memberof V_Cart
     */
    public GOODSSTATUS: CartGoodsStatus;
}
export class V_Category extends T_Category {}
export class V_Member_Coupon extends T_Member_Coupon {
    //开始时间
    public STARTDAY: string;

    //到时时间
    public ENDDAY: string;
    //领取时间
    cer;
}
export class V_Currency extends T_Currency {
    //开始时间
    public STARTDAY: string;

    //到时时间
    public ENDDAY: string;
}
export class V_ReceivingAddress extends T_ReceivingAddress {}
export class V_Product extends T_Product {
    public PicList: Array<string> = new Array<string>();
}
export class V_ShoppingCart extends T_ShoppingCart {
    public Selected: boolean = false;
    public EditVisable: boolean = false;
}
export class V_ShoppingCartHelper extends TYObject {
    public ShopID: number;
    public Name: string;
    public EditVisable: boolean = false;
    public Selected: boolean = false;
    public Products: Array<V_Cart> = new Array<V_Cart>();
}

export class V_Order extends T_Order {}
